package com.hackintosh.singleton.pattern.lazy;

/**
 * @description：总统
 * @author：twislyn
 * @date：Created in 2021/05/04
 * @modified By：
 * @version: 1.0
 */
public class President {
    private static volatile President president = null;

    private President(){
        System.out.println("缔造一个奇迹！");
    }

    public static synchronized President getInstance(){
        if(president==null){
            president = new President();
        }else {
            System.out.println("奇迹已经出现，不能产生新奇迹！");
        }
        return president;
    }

    public void getName(){
        System.out.println("我是奇迹缔造者：hack");
    }
}
